home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / lib / mathlib / psort / example / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.0 KB  |  73 lines

  1. /* *****************************************************************************
  2. *
  3. * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  4. * All Rights Reserved.
  5. *
  6. * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  7. * the contents of this file may not be disclosed to third parties, copied or
  8. * duplicated in any form, in whole or in part, without the prior written
  9. * permission of Silicon Graphics, Inc.
  10. *
  11. * RESTRICTED RIGHTS LEGEND:
  12. * Use, duplication or disclosure by the Government is subject to restrictions
  13. * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  14. * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  15. * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  16. * rights reserved under the Copyright Laws of the United States.
  17. *
  18. ***************************************************************************** */
  19. #include "fast.h"
  20. #include "event.h"
  21. #include "device.h"
  22.  
  23. extern void do_quit(), do_rightmouse(), display(), ShowFast();
  24. extern void this_run(), that_run(), this_quit(), do_reset(), do_shuffle();
  25.  
  26. int mainmenu, quitmenu;
  27.  
  28. extern int x_size, y_size;
  29.  
  30. Init(name)
  31. char *name;
  32. {
  33.     keepaspect(1, 1);
  34.     prefsize(ZOOM_FACTOR*x_size+2*BORDER,ZOOM_FACTOR*y_size+2*BORDER);
  35.     {
  36.         char *t, *strrchr();
  37.         winopen((t=strrchr(name, '/')) != NULL ? t+1 : name);
  38.     }
  39.  
  40.     wintitle("PSORT-QSORT");
  41.  
  42.     add_event(ANY, REDRAW, ANY, display, NULL);
  43.     qdevice(REDRAW);
  44.     
  45.     add_event(ANY, ESCKEY, UP, do_quit, NULL);
  46.     qdevice(ESCKEY);
  47.  
  48.     add_event(ANY, WINQUIT, ANY, do_quit, NULL);
  49.     qdevice(WINQUIT);
  50.     
  51.     add_event(ANY, RIGHTMOUSE, DOWN, do_rightmouse, NULL);
  52.     qdevice(RIGHTMOUSE);
  53.  
  54.     RGBmode();
  55.     doublebuffer();
  56.     gconfig();
  57.  
  58.     shademodel(FLAT);
  59.  
  60.     do_reset();
  61.     CreateMenus();
  62. }
  63.  
  64.     char str[64];
  65. CreateMenus() {
  66.  
  67.     mainmenu = defpup("Psort-Qsort %t|Reset %f|Shuffle %f|------|Run Qsort %f|Run Psort %f|------|Quit %f",
  68.         do_reset, do_shuffle, this_run , that_run, this_quit);
  69.  
  70.     quitmenu = defpup("Quit %t|Really %f|Cancel %f",
  71.             do_quit, ShowFast);
  72. }
  73.